package com.itheima.servlet;

import com.itheima.dao.UserDao;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class CreateBean {

    /**
     * 创建Bean对象的三种方式
     * @param args
     */
    public static void main(String[] args) {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("bean_annotation.xml");
        UserDao userDao = (UserDao) applicationContext.getBean("UserDao");
        System.out.println(userDao);


        UserDao userDaoStatic = applicationContext.getBean("UserDaoStatic", UserDao.class);
        System.out.println(userDaoStatic);
    }
}
